package org.springblade.oa.controller;

import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import org.springblade.oa.entity.Bxsh;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.Func;
import org.springblade.oa.service.IBxshService;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;

/**
 * @version 1.0.0
 * @Title: BxController.java
 * @Description: TODO
 */

@RestController
@RequestMapping("bxshapi")
@AllArgsConstructor
public class BxshController {
	private IBxshService bxshService;
	/**
	 * 新增或修改
	 */
	@PostMapping("/submit")
	@ApiOperationSupport(order = 4)
	@ApiOperation(value = "新增或修改", notes = "传入Bxsh")
	public R submit(@Valid @RequestBody Bxsh bxsh) {
		return R.status(bxshService.submit(bxsh));
	}

	/**
	 * 修改
	 */
	@PostMapping("/update")
	@ApiOperationSupport(order = 5)
	@ApiOperation(value = "修改", notes = "传入User")
	public R update(@Valid @RequestBody Bxsh bxsh) {
		return R.status(bxshService.updateById(bxsh));
	}

	/**
	 * 删除
	 */
	@PostMapping("/remove")
	@ApiOperationSupport(order = 6)
	@ApiOperation(value = "删除", notes = "传入地基和")
	public R remove(@RequestParam String ids) {
		return R.status(bxshService.deleteLogic(Func.toIntList(ids)));
	}


}
